<%@page import="com.student.entity.Student"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>更新信息</title>
<link rel="stylesheet" type="text/css" href="page/css/bootstrap.min.css">
<script type="text/javascript" src="page/js/jquery.min.js"></script>
<script type="text/javascript" src="page/js/bootstrap.min.js"></script>
<style type="text/css">
input[type='submit'],input[type='reset']{width: 45%;}

</style>
</head>
<body>
<%
String user=(String) session.getAttribute("user");
if(user==null){
	//out.print("你还没有登录！！！");
	//out.print("<a href='../login.jsp'>登录</a>");
	response.sendRedirect("page/error/needLogin.jsp");
}else{
	
%>
<%
response.setCharacterEncoding("utf-8");
Student student=(Student) request.getAttribute("student");
String result=(String) request.getAttribute("result");
%>

<%
if(student==null){
	System.out.println("none exist!---form page show");
}else{
%>	
<form action="updateStudentServlet" method="post" class="form-horizontal col-md-12" role="form" style="margin-top: 20px;">

	<div class="form-group">
		<label class="col-sm-2 control-label">工号/学号:</label>
		<div class="col-sm-10">
			<input class="form-control" type="text" name="uid" id="uid" value="<%=student.getId()%>" readonly="readonly"><span></span>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">用户名:</label>
		<div class="col-sm-10">
			<input class="form-control" type="text" value="<%=student.getUname()%>" name="uname" id="uname" required="required"><span></span>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">用户密码:</label>
		<div class="col-sm-10">
			<input class="form-control" type="text" value="<%=student.getUpass()%>" name="upass" id="upass" required="required"><span></span>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">部门/院系:</label>
		<div class="col-sm-10">
			<select class="form-control" name="udepart" id="udepart" value="<%=student%>">
					<option>信息工程学院</option>
					<option selected="selected">外国语学院</option>
					<option>艺术与传媒学院</option>
					<option>法学院</option>
					<option>管理学院</option>
					<option>会计学院</option>
					<option>金融与经济学院</option>
			</select><span></span>
		</div>
	</div>

	<div class="form-group">
		<label class="col-sm-2 control-label">用户类型:</label>
		<div class="col-sm-10">
			<select class="form-control" type="text"  value="<%=student.getType()%>" name="utype" id="utype" required="required">
					<option>1</option>
					<option>2</option>
			</select><span></span>
		</div>
	</div>


	<div class="form-group">
		<label class="col-sm-2 control-label"></label>
		<div class="col-sm-10">
			<input type="submit" value="提交" id="submit" class="btn btn-success pull-left">
			<input type="reset" value="重置" id="reset" class="btn btn-waring pull-right">
		</div>
	</div>
</form>
<%} %>
<%if(result!=null){
%>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" 
						aria-hidden="true">×
				</button>
				<h4 class="modal-title" id="myModalLabel">
					更新结果提示：
				</h4>
			</div>
			<div class="modal-body">
				<%= result %>
			</div>
			<div class="modal-footer">
				<a href="window.history.back();">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</a>
				
				<a href="selectStudentsServlet">
					<button type="button" class="btn btn-primary">查看详情</button>
				</a>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
	<script type="text/javascript">
	$('#myModal1').modal({
keyboard: false
})
	
	</script>
<%	
}
%>
<script type="text/javascript" src="page/js/formCheck.js"></script>
<%} %>
</body>
</html>